package test.test_7_11;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.Comparator;

/*
rsztuvijxypbmnocklwaefghdq
 */
public class Demo03 {
    public static void main(String[] args) throws IOException {
        FileInputStream fileInputStream = new FileInputStream("b.txt");
        FileOutputStream fileOutputStream = new FileOutputStream("b.txt", true);

        byte[] arr = fileInputStream.readAllBytes();
        String str = new String(arr);
        //System.out.println(str);

        char[] charArray = str.toCharArray();

        Arrays.sort(charArray);

        String s = "";
        for (int i = 0; i < charArray.length; i++) {
            s += charArray[i];
        }
        //System.out.println(s);

        fileOutputStream.write("\r\n".getBytes());
        fileOutputStream.write(s.getBytes());

    }
}
